package megrez.boot.autoconfigure.minio;

import java.time.Duration;

import org.springframework.boot.context.properties.ConfigurationProperties;

import lombok.Data;

/**
 * 配置文件
 * 
 * @author Lucky Yang
 * @since 2.6.9
 */
@Data
@ConfigurationProperties(prefix = "minio")
public class MinioProperties {

    
    /** 服务器参数 */
    private Server server = new Server();
    /** 连接参数 */
    private Connection connection = new Connection();
    /** 连接参数 */
    private Proxy proxy = new Proxy();

    @Data
    public static class Proxy {
        private String host;
        private Integer port;
    }

    @Data
    public static class Connection {
        /**
         * Define the connect timeout for the Minio Client.
         */
        private Duration connectTimeout = Duration.ofSeconds(10);

        /**
         * Define the write timeout for the Minio Client.
         */
        private Duration writeTimeout = Duration.ofSeconds(60);

        /**
         * Define the read timeout for the Minio Client.
         */
        private Duration readTimeout = Duration.ofSeconds(10);
    }

    @Data
    public static class Server {

        /**
         * URL for Minio instance. Can include the HTTP scheme. Must include the port.
         * If the port is not provided, then the port of the HTTP is taken.
         */
        private String endpoint = "127.0.0.1";

        private Integer port = 9000;

        /**
         * Access key (login) on Minio instance
         */
        private String accessKey = "admin";

        /**
         * Secret key (password) on Minio instance
         */
        private String secretKey = "admin";

        /**
         * If the scheme is not provided in {@code url} property, define if the
         * connection is done via HTTP or HTTPS.
         */
        private boolean secure = false;
    }

}
